<?php $this->headTitle(__('Users')); ?>
<div id="maincontent">
	<?php echo $this->searchForm(__('Search User')); ?>
	<table width="100%">
		<thead>
			<th><?php echo $this->sortLink(__('ID'),'id') ?></th>
			<th><?php echo $this->sortLink(__('First Name'),'fname') ?></th>
			<th><?php echo $this->sortLink(__('Last Name'),'lname') ?></th>
            <th><?php echo $this->sortLink(__('Address'),'address') ?></th>
			<th><?php echo $this->sortLink(__('Email'),'email') ?></th>
			<th><?php echo $this->sortLink(__('Role'),'role') ?></th>
			<th class="action"><?php echo __('Action'); ?></th>
		</thead>
		<tbody>
			<?php if($this->users): ?>
				<?php foreach($this->users as $key => $user): ?>
					<tr class="<?php echo ($key % 2 == 0)?'even':'odd'; ?>">
						<td><?php echo $user['id']; ?></td>
						<td><?php echo $user['first_name']; ?></td>
						<td><?php echo $user['last_name']; ?></td>
                        <td><?php echo $user['address']; ?></td>
						<td><?php echo $user['email'] ?></td>
						<td><?php echo $user['role_name'] ?></td>
						<td><a class="edit" href="<?php echo $this->baseUrl('admin/user/edit/id/'.$user['id']) ?><?php echo ($this->page)?"/page/".$this->page:''; ?>">&nbsp;</a>
								<a class="delete"
								   del:url="<?php echo $this->siteURL.'/admin/user/delete/id/'.$user['id']; ?><?php echo ($this->page)?"/page/".$this->page:''; ?>">&nbsp;
								</a>
							<a class="show" href="<?php echo $this->baseUrl('admin/user/show/id/'.$user['id']); ?>">&nbsp;</a>
						</td>
					</tr>
				<?php endforeach; ?>
			<?php else: ?>
					<tr><td colspan="6" align="center"><?php echo __('User not found'); ?></td></tr>
			<?php endif; ?>
		</tbody>
	</table>
	<?php echo $this->pagination();?>
</div>
<script type="text/javascript">
$(document).ready(function(){
	$('.delete').click(function(){
		setDeleteDialog($(this).attr('del:url'));
	});
});
</script>